package com.zx.chatroom.listener;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.zx.chatroom.util.CONST;
import com.zx.framework.core.util.SpringBeanUtil;
import com.zx.framework.core.util.StringUtil;

import java.util.HashMap;
import java.util.Map;

public class BaseListener {
	/**
     * gson时间格式化
     */
	protected String gsonDateFormat = "yyyy-MM-dd HH:mm:ss";
    /**
     * 输出格式化 用于调试
     */
    private boolean prettyPrinting = false;

    protected GsonBuilder builder = new GsonBuilder();

    protected Gson gson = getGson();

    /**
     * 获取gson对象
     *
     * @return
     */
    protected Gson getGson() {

        if (StringUtil.isNotEmpty(gsonDateFormat)) {
            builder.setDateFormat(gsonDateFormat);
        }
        if (prettyPrinting) {
            builder.setPrettyPrinting();
        }
        builder.serializeNulls();
        return builder.create();
    }
    
    /**
	 * 忙碌
	 */
	protected static final String BUSY ="1" ;
	/**
	 * 在线
	 */
	protected static final String ONLINE = "0";
	/**
	 * 坐席
	 */
	protected static final String SEAT = CONST.SEAT;
	/**
	 * 营业员
	 */
	protected static final String VISIT = CONST.VISIT;
	/**
	 * 评分
	 * 1,满意 2,一般 3,不满意
	 */
	protected static Map<String, String> SCORE_DATA;
	
	static {
		SCORE_DATA = new HashMap<String, String>();
		SCORE_DATA.put("1", "满意");
		SCORE_DATA.put("2", "一般");
		SCORE_DATA.put("3", "不满意");
	}
	
}
